package com.netscenery.yang.designer;

import java.util.ArrayList;

public class Parameter {
	private String name;
	private ArrayList<String> values;
	private boolean display;
	private boolean mandatory = true;
	private MethodInfo method;
	private Parameter refer;
	
	public Parameter(String name, boolean display){
		this.name = name;
		this.display = display;
	}
	public Parameter(String name, boolean display,boolean mandatory){
		this.name = name;
		this.display = display;
		this.mandatory = mandatory;
	}
	public Parameter(String name, ArrayList<String> values,boolean display){
		this.name = name;
		this.display = display;
		this.values = values;
	}
	public Parameter(String name, ArrayList<String> values,
			boolean display,boolean mandatory){
		this.name = name;
		this.display = display;
		this.values = values;
		this.mandatory = mandatory;
	}
	public Parameter(String name, MethodInfo method,
			boolean display,boolean mandatory){
		this.name = name;
		this.display = display;
		this.method = method;
		this.mandatory = mandatory;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the display
	 */
	public boolean isDisplay() {
		return display;
	}
	/**
	 * @param display the display to set
	 */
	public void setDisplay(boolean display) {
		this.display = display;
	}
	/**
	 * @return the values
	 */
	public ArrayList<String> getValues() {
		return values;
	}
	/**
	 * @param values the values to set
	 */
	public void setValues(ArrayList<String> values) {
		this.values = values;
	}
	
	public boolean addValue(String value){
		if (null == value){
			return false;
		}
		if (null == values){
			values = new ArrayList<String> (1);
		}
		return values.add(value);
	}
	
	public String getValue(int index){
		if (null == values){
			return null;
		}
		
		return values.get(index);
	}
	/**
	 * @return the mandatory
	 */
	public boolean isMandatory() {
		return mandatory;
	}
	/**
	 * @param mandatory the mandatory to set
	 */
	public void setMandatory(boolean mandatory) {
		this.mandatory = mandatory;
	}
	/**
	 * @return the method
	 */
	public MethodInfo getMethod() {
		return method;
	}
	/**
	 * @param method the method to set
	 */
	public void setMethod(MethodInfo method) {
		this.method = method;
	}
	/**
	 * @return the refer
	 */
	public Parameter getRefer() {
		return refer;
	}
	/**
	 * @param refer the refer to set
	 */
	public void setRefer(Parameter refer) {
		this.refer = refer;
	}
	
}
